#include <ctime>
#include <cstdlib>
#include <iostream>
#include <unistd.h>

#include "ThreadPool.hpp"
#include "Task.hpp"

int main()
{
    srand((unsigned long)time(nullptr)^getpid());
    ThreadPool<Task>::getThreadPool()->run();
    while(1)
    {
        int x=rand()%100 + 1;
        usleep(7721);
        int y=rand()%30 + 1;
        Task t(x, y, [](int x, int y)->int
        {
            return x+y;
        });
        logMessage(DEBUG, "制作任务完成: %d+%d = ?", x, y);
        ThreadPool<Task>::getThreadPool()->pushTask(t);
        sleep(1);
    }
    return 0;
}